package controllers;



import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.util.Random;
import java.util.List;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import models.Filestore;
import models.Sysinfo;
import models.Userlogin;

import rbac.impl.DefaultRbacService;
import rbac.models.Menu;
import rbac.models.Oplog;
import rbac.models.User;
import utils.ConfigUtil;
import utils.Md5Util;

import com.et.mvc.BinaryView;
import com.et.mvc.filter.BeforeFilter;
import com.et.mvc.filter.BeforeFilters;
import com.sun.jimi.core.Jimi;
import com.sun.jimi.core.raster.JimiRasterImage;


public class ImageController extends PortalController {
	
	
	
	
	public BinaryView showFile(int id) throws Exception{
		Filestore file = Filestore.find(Filestore.class, id );
		byte[] data = null;
		if (file != null){
			data = file.getData();
			BinaryView view = new BinaryView();
			view.setData(data);
			view.setContentType("image/jpeg");
			return view;
		}else{
			return null;
		}
		
	}
	
	public BinaryView showSwfFile(int id) throws Exception{
		Filestore file = Filestore.find(Filestore.class, id );
		byte[] data = null;
		if (file != null){
			data = file.getData();
			BinaryView view = new BinaryView();
			view.setData(data);
			view.setContentType("application/x-shockwave-flash");
			return view;
		}else{
			return null;
		}
		
	}
	
}
